﻿using System.Collections.Generic;

/// <summary>
/// Collection of WebCases
/// </summary>
internal class WebCaseCollection : List<WebCase>
{
    /// <summary>
    /// Initializes a new instance of the <see cref="WebCaseCollection"/> class.
    /// </summary>
    public WebCaseCollection()
    {
    }

    public WebCaseCollection GetClonedWebCases()
    {
        WebCaseCollection clonedWebCases = new WebCaseCollection();
        foreach (WebCase webCase in this)
        {
            clonedWebCases.Add((WebCase) webCase.Clone());
        }
        return clonedWebCases;
    }

    public WebCase GetCaseById(int id)
    {
        foreach (WebCase webCase in this)
        {
            if (webCase.CustomerFeedbackID == id)
            {
                return webCase;
            }
        }
        return null;
    }

    public WebCaseCollection CaseNotCreatedInCrm()
    {
        WebCaseCollection clonedWebCases = new WebCaseCollection();
        foreach(WebCase web in this)
        {
            if(web.HasBeenFoundInCrm==false)
            {
                clonedWebCases.Add((WebCase)web.Clone());
            }
        }
        return clonedWebCases;
    }
}